package com.ruoyi.common.business.dao;

import com.ruoyi.common.business.entity.YytAttrGroup;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * 属性分组 Mapper 接口
 * </p>
 *
 * @author huangshun
 * @since 2021-12-16
 */
@Repository
public interface YytAttrGroupMapper extends BaseMapper<YytAttrGroup> {

    /**
     * 根据attrIds获取对应的分组列表
     */
    @Select("select distinct ag.* from yyt_attr_group ag, yyt_attr_attrgroup_relation aar where " +
            "aar.attr_id in (${attrIds}) and ag.attr_group_id = aar.attr_group_id order by ag.sort asc")
    List<YytAttrGroup> listByAttrIds(@Param("attrIds") String attrIds);

}
